//
// Created by 原帅 on 2022/10/3.
//

#ifndef R_RMEMOBJ_H
#define R_RMEMOBJ_H

#include <unistd.h>
#include <stdint.h>

typedef struct RMEMORYINFO{
    int64_t memsize ;
    int64_t totalcount ;
    int64_t curnullptr ;
} RMemoryInfo ;

class RMemObj {

protected:
    int key = 0;
    int shmId = 0;
    void* shmAddr = nullptr;
    bool initialized = false;
    RMemoryInfo *rMemoryInfo = nullptr;

public:
    int getKey() const;

    int getShmId() const;

    void *getShmAddr() const;

    bool isInitialized() const;

    RMemoryInfo *getRMemoryInfo() const;

    uint64_t nextptr();

    uint64_t lastdataptr();

    uint64_t count();
};


#endif //R_RMEMOBJ_H
